<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%pageContext.setAttribute("ctx", request.getContextPath()); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>博客后台管理</title>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8">
		<link href="${ctx}/admin/images/style.css" type="text/css"
			rel="stylesheet">			
<script language="JavaScript">
	function update(){
			document.forms[0].m.value="update";
			document.forms[0].submit();
	}
	function del(){
		if(confirm('您真的要删除吗？')){
			document.forms[0].m.value="delete";
			document.forms[0].submit();
		}
	}
</script>

	</head>
	<body>
		<div id="container">
			<div id="main">
			<h3>评论列表</h3>
<s:form action="handleComments" theme="simple">
<s:hidden  name="m" value=""/>
<table id="tab">
<tr>
   <th>选中</th>
   <th>编号</th>
   <th>作者</th>   
    <th>IP</th>    
   <th>添加时间</th>   
   <th>状态</th>   
</tr>
<c:forEach items="${pagination.list}" var="c">
	<tr>
	       <td><input type="checkbox"  name="commentId" value="${c.id}" /></td>
		   <td>${c.id}</td>
	       <td>${c.author}</td>	     
		   <td>${c.ip}</td>
	       <td>${c.createdTime}</td>
	       <td>
	       <c:if test="${c.status==1}">
	       		<img src="${ctx}/admin/images/yes.gif" border="0" alt="开">
	       </c:if>
	       	<c:if test="${c.status==0}">
	       		<img src="${ctx}/admin/images/no.gif" border="0" alt="关">
	       	</c:if>
	       </td>	       
	</tr>
	</c:forEach>
	<tr>
   <td colspan="6"><input type="button" onclick="update()" value="改变选中项的状态"/> <input type="button" onclick="del()" value="删除选中项"/></td>
 </tr>
</table>
</s:form> 
					<!--分页的链接,开始-->
					<pg:pager id="pagination" url="${ctx}/admin/listComments" items="${pagination.maxElements}" maxPageItems="${pagination.pageSize}"  maxIndexPages="10">
						<pg:index>
							<pg:prev>
								<a href="${pageUrl}&p=${pageNumber}">&lt;上一页</a>
							</pg:prev>
							<pg:pages>
								<a href="${pageUrl}&p=${pageNumber}">${pageNumber}</a>				
							</pg:pages>
							<pg:next>
								<a href="${pageUrl}&p=${pageNumber}">下一页&gt;</a>
							</pg:next>
						</pg:index>
					</pg:pager>		
					<!--分页的链接,结束-->					

       </div>
		</div>
		<%@include file="/admin/footer.jsp"%>